<%-- 
    Document   : dsSanpham
    Created on : 30-09-2011, 13:31:49
    Author     : Mr-Nguyen
--%>


<%@page import="DatabasePOJO.sanpham"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<table width="100%"  border="0" style="background-color: peachpuff">
    <%
   ArrayList<sanpham> arr = (ArrayList<sanpham>)session.getAttribute("sp");
   int size = arr.size();
        if(size > 10)
            size = 8;
        if(size % 2 != 0)
            size--;
   for(int i =0; i<size;i = i + 2){
       
%>
  	<tr>
    <td width="49%" height="274">
  	   <table width="100%"  border="0">
        <tr>
          <td height="54" style="background-color:pink">
              <a href="index.jsp?Action=chitiet&MaSanPham=<%= arr.get(i).getMaSanPham() %>"><%= arr.get(i).getTitle().substring(0, 50) %>...</a>
          </td>
        </tr>
        <tr>
          <td height="199">
              <img src="Images/<%= arr.get(i).getHinhDaiDien() %>" alt="" width="100%" height="205" />
          </td>
        </tr>
        <tr>
          <td height="53">
              <table width="100%" border="0" background="Images/backlogo.gif">
            <tr>
              <td width="50%" style="text-decoration: line-through;">
                  <%= arr.get(i).getGiaBan() %>VNĐ
              </td>
              <td width="50%" rowspan="2" align="center">
                  <%= arr.get(i).getGiaKhuyenMai() %>VNĐ
              </td>
            </tr>
            <tr>
              <td >
                  <%= Integer.parseInt(arr.get(i).getGiaBan()) - Integer.parseInt(arr.get(i).getGiaKhuyenMai())  %>VNĐ
              </td>
              </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td height="40">
          <table width="100%" border="0" background="Images/backmua.png">
            <tr>
                <td width="36%" align="right"  colspan="2">
                    <a href="index.jsp?Action=Mua&MaspMua=<%= arr.get(i).getMaSanPham() %>">  <img src="Images/muato.png" width="65" height="30" /></a>
                    <%= arr.get(i).getLuotMua() %> Lược mua
                </td>
            </tr>
          </table>
          </td>
        </tr>
    </table>
    </td>
    <td width="2%" background="Images/backtable.gif">&nbsp;</td>
    <td width="49%" valign="top">
  	    	   <table width="100%"  border="0">
        <tr>
          <td height="54" style="background-color:pink">
              <a href="index.jsp?Action=chitiet&MaSanPham=<%= arr.get(i+1).getMaSanPham() %>"> <%= arr.get(i+1).getTitle().substring(0, 50) %>...</a>
          </td>
        </tr>
        <tr>
          <td height="199">
              <img src="Images/<%= arr.get(i+1).getHinhDaiDien() %>" alt="" width="100%" height="205" />
          </td>
        </tr>
        <tr>
          <td height="53">
          <table width="100%" border="0" background="Images/backlogo.gif">
            <tr>
              <td width="50%" style="text-decoration: line-through;">
                  <%= arr.get(i+1).getGiaBan() %>VNĐ
              </td>
              <td width="50%" rowspan="2" align="center">
                  <%= arr.get(i+1).getGiaKhuyenMai() %>VNĐ
              </td>
            </tr>
            <tr>
              <td >
                  <%= Integer.parseInt(arr.get(i+1).getGiaBan()) - Integer.parseInt(arr.get(i+1).getGiaKhuyenMai())  %>VNĐ
              </td>
              </tr>
          </table>
          </td>
        </tr>
        <tr>
          <td height="40">
          <table width="100%" border="0" background="Images/backmua.png">
            <tr>
                <td width="36%" align="right" colspan="2" >
                    <a href="index.jsp?Action=Mua&MaspMua=<%= arr.get(i+1).getMaSanPham() %>">  <img src="Images/muato.png" width="65" height="30" /></a>
                    <%= arr.get(i+1).getLuotMua() %> Lượt mua.</td>
            </tr>
          </table>
          </td>
        </tr>
        
    </table>
    </td>
        </tr>
        <%}%>
</table>

 